import { createRouter, createWebHashHistory } from 'vue-router';

import Layout from '@/layout/Index.vue';

export const routes = [
	{
		path: '/',
		component: () => import('@/layout/Index.vue'),
		name: 'HomeLayout',
		meta: { title: '首页', icon: 'el-icon-s-home' },
		children: [{
			path: 'home',
			component: () => import('@/views/Home.vue'),
			name: 'home',
			meta: { title: '首页', icon: 'dashboard' },
			children: []
		}]
	},
	{
		path: '/login',
		name: 'login',
		hidden: true,
		meta: { title: '系统', icon: 'el-icon-s-data' },
		component: () => import('@/views/Login.vue')
	},
	{
		path: '/',
		component: () => import('@/layout/Index.vue'),
		redirect: 'home',
		meta: { title: '系统1', icon: 'el-icon-s-data' },
		children: [
			{
				path: 'table',
				component: () => import('@/views/Table.vue'),
				name: 'table',
				meta: { title: '表格', icon: 'dashboard' },
				children: []
			},
			{
				path: 'form',
				component: () => import('@/views/Form.vue'),
				name: 'form',
				meta: { title: '表单', icon: 'dashboard' },
				children: []
			},
			{
				path: 'form5',
				component: () => import('@/views/Form.vue'),
				name: 'form5',
				meta: { title: '表单5', icon: 'dashboard' },
				children: []
			},
			{
				path: 'form6',
				component: () => import('@/views/Form.vue'),
				name: 'form6',
				meta: { title: '表单6', icon: 'dashboard' },
				children: []
			},
		]
	},
	{
		path: '/sys',
		component: () => import('@/layout/Index.vue'),
		name: 'System',
		redirect: 'sys',
		meta: { title: '系统', icon: 'el-icon-s-data' },
		children: [
			{
				path: 'user1',
				component: () => import('@/views/Table.vue'),
				name: 'user1',
				meta: { title: '用户1', icon: 'dashboard' },
				children: []
			},
			{
				path: 'form1:id',
				component: () => import('@/views/Form.vue'),
				name: 'form11111',
				meta: { title: '表单11111', icon: 'dashboard' },
				children: []
			},
			{
				path: 'form1',
				component: () => import('@/views/Form.vue'),
				name: 'form1',
				meta: { title: '表单1', icon: 'dashboard' },
				children: []
			}
		]
	}
];

const router = createRouter({
	history: createWebHashHistory(process.env.BASE_URL),
	routes: routes
});

export default router;
